package com.yhsimon.feign;

import com.yhsimon.entity.Commodity;
import com.yhsimon.entity.CommodityVO;
import com.yhsimon.entity.Type;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(value = "commodity")
public interface CommodityFeign {
    @GetMapping("/commodity/findAll/{page}/{limit}")
    public CommodityVO findAll(@PathVariable("page") int page, @PathVariable("limit") int limit);

    @GetMapping("/commodity/findById/{id}")
    public Commodity findById(@PathVariable("id") int id);

    @GetMapping("/commodity/findByName/{page}/{limit}/{name}")
    CommodityVO findByName(@PathVariable("page")int page,@PathVariable("limit") int limit,@PathVariable("name") String name);

    @DeleteMapping("/commodity/deleteById/{id}")
    public void deleteBytId(@PathVariable("id") int id);

    @GetMapping("/commodity/findAllTypes")
    public List<Type> findAllTypes();


    @PutMapping("/commodity/update")
    void update(@RequestBody Commodity commodity);


    @PostMapping(value = "/commodity/save")
    public void save(@RequestBody Commodity commodity);


}
